package com.dnjn.happiness.emo.api.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dnjn.happiness.common.core.web.domain.BaseEntity;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.math.BigDecimal;


/**
 * userModelScore对象 emo_user_model_score
 *
 * @author amber
 * @date 2024-03-02
 */
@Schema(name = "UserModelScore", description = "userModelScore")
@Accessors(chain = true)
@Getter
@Setter
@Data
@TableName("emo_user_model_score")
public class UserModelScore extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /**
     * 是否删除|0-否 1-是
     */
    private String deleted;

    /**
     *
     */
    private BigDecimal recordScore;

    /**
     *
     */
    private BigDecimal totalScore;

    /**
     * sys_user.user_id
     */
    private Long userId;

    /**
     *
     */
    private BigDecimal baseScore;

    

    /**
     * 模块类型emo_risk.rtype
     */
    private String rtype;

    public BigDecimal getRecordScore() {
        if(recordScore == null ){
            return BigDecimal.valueOf(0.0);
        }
        return recordScore;
    }

    public BigDecimal getTotalScore() {
        if(totalScore == null){
            return BigDecimal.valueOf(0.0);
        }
        return totalScore;
    }

    public BigDecimal getBaseScore() {
        if(baseScore== null){
            return BigDecimal.valueOf(0.0);
        }
        return baseScore;
    }

    public Double getAddScore() {
        if(addScore==null){
            return 0.0;
        }
        return addScore;
    }

    public Double getBaseRecordScore() {
        if(baseScore==null){
            return 0.0;
        }
        return baseRecordScore;
    }

    /**
     * PK
     */
    @JsonSerialize(using = ToStringSerializer.class)
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;
    @TableField(exist = false)
    private Double historyScore;

    private Double addScore;

    private Double aiImageTotalScore;

    private Double baseRecordScore;

    public Double getAiImageTotalScore() {
        return aiImageTotalScore == null ? 0.00 : aiImageTotalScore;
    }


    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("deleted", getDeleted())
                .append("recordScore", getRecordScore())
                .append("totalScore", getTotalScore())
                .append("userId", getUserId())
                .append("baseScore", getBaseScore())
                .append("rtype", getRtype())
                .append("id", getId())
                .toString();
    }
}
